// index.js
const app = getApp()
Page({
  data: {
    totalExpense: 0,
    upcomingBirthdays: []
  },
  onLoad: function () {
    // 页面加载时执行，从全局数据中获取总消费和生日提醒
    this.setData({
      totalExpense: app.globalData.totalExpense,
      upcomingBirthdays: this.getUpcomingBirthdays()
    })
  },
  getUpcomingBirthdays: function () {
    // 获取未来一个月内的生日提醒
    const now = new Date()
    const oneMonthLater = new Date(now.getTime() + 30 * 24 * 60 * 60 * 1000)
    return app.globalData.birthdays.filter(birthday => 
      new Date(birthday.date) >= now && new Date(birthday.date) <= oneMonthLater
    )
  },
  goToRecord: function () {
    // 跳转到记账页面
    wx.navigateTo({
      url: '/pages/record/record'
    })
  },
  goToHistory: function () {
    // 跳转到历史记录页面
    wx.navigateTo({
      url: '/pages/history/history'
    })
  },
  goToRenovation() {
    wx.navigateTo({
      url: '/pages/renovation/renovation'
    })
  }
})
// pages/renovation/renovation.js
// pages/renovation/renovation.json
// pages/renovation/renovation.wxml
// pages/renovation/renovation.wxss
